<template>
	<view class="pay-result">
		<nav-bar title="支付确认" backUrl="/pages/index"></nav-bar>
		<view class="icon-box">
			<uni-icons v-if="payResult === 'success'" type="checkbox-filled" color="#51c51b" size="54" />
			<uni-icons v-else type="clear" color="#fa2d07" size="54" />
		</view>
		<view class="success-text" v-if="payResult === 'success'">
			支付成功
		</view>
		<view class="error-text" v-else>
			支付失败
		</view>
		<view class="button" @click="button">确 定</view>
	</view>
</template>

<script>
	import NavBar from "@/components/nav-bar"
	export default {
		name: 'PayResult',
		components: {
			NavBar
		},
		data() {
			return {
				payResult: ''
			}
		},
		onLoad(options) {
			this.payResult = options.payResult
		},
		methods: {
			button() {
				uni.switchTab({
					url: '/pages/index'
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.pay-result {
		text-align: center;

		.icon-box {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 300rpx;
		}

		.success-text,
		.error-text {
			margin-top: 20rpx;
			font-size: 36rpx;
			font-weight: bold;
		}

		.error-text {
			color: #fa2d07;
		}
	}

	.button {
		position: fixed;
		bottom: 30rpx;
		left: 30rpx;
		right: 30rpx;
		background-color: #c27e15;
		border-radius: 25px;
		color: #fff;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 30rpx;
	}
</style>